unit EditLine;

interface

uses
  Winapi.Windows, Winapi.Messages, SysUtils, Variants, Classes, Graphics,
  Controls, Forms, Dialogs, uniGUITypes, uniGUIAbstractClasses,
  uniGUIClasses, uniGUIForm, uniLabel, jpeg, uniGUIBaseClasses, uniImage,
  uniMultiItem, uniComboBox, uniDBComboBox, uniEdit, uniDBEdit, uniButton,
  uniBitBtn, uniMemo, uniDBMemo, DB, DBClient, ClientRowSet, uniBasicGrid,
  uniDBGrid, uniDBLookupComboBox;

type
  TFrmEditLine = class(TUniForm)
    UniImage8: TUniImage;
    lbCaption: TUniLabel;
    btSave: TUniBitBtn;
    btClose: TUniBitBtn;
    lbCompTel: TUniLabel;
    edLineName: TUniDBEdit;
    UniLabel1: TUniLabel;
    UniLabel2: TUniLabel;
    UniLabel5: TUniLabel;
    crsLine: TClientRowSet;
    crsLineLINE_ID: TStringField;
    crsLineLINE_CODE: TStringField;
    crsLineLINE_NAME: TStringField;
    crsLineLINE_TYPE: TStringField;
    crsLineGROUP_CODE: TStringField;
    crsLineGROUP_NAME: TStringField;
    crsLineSRC_NODE_NO: TStringField;
    crsLineSRC_NODE_NAME: TStringField;
    crsLineDST_NODE_NO: TStringField;
    crsLineDST_NODE_NAME: TStringField;
    crsLineSRC_CITY: TStringField;
    crsLineDST_CITY: TStringField;
    crsLineFETCH_FUNC: TStringField;
    crsLineDISP_FUNC: TStringField;
    crsLineLINE_FUNC: TStringField;
    crsLineOPT_FUNC: TStringField;
    crsLineINSURE_FUNC: TStringField;
    crsLineFEE_FUNC: TStringField;
    crsLineSYS_ACCOUNT: TStringField;
    crsLineVERSION: TSmallintField;
    crsLineSTART_WGT: TFloatField;
    crsLineSTART_FEE: TFloatField;
    crsLinePRICE: TFloatField;
    crsLineROUTE_LOCATION: TStringField;
    dsNode: TDataSource;
    cbSendNode: TUniDBLookupComboBox;
    cbDstNode: TUniDBLookupComboBox;
    cbType: TUniDBComboBox;
    dsLine: TDataSource;
    UniLabel3: TUniLabel;
    UniDBMemo1: TUniDBMemo;
    crsFunc: TClientRowSet;
    crsFuncLINEFUNC_ID: TStringField;
    crsFuncLINE_ID: TStringField;
    crsFuncLINE_NAME: TStringField;
    crsFuncFUNC_TYPE: TStringField;
    crsFuncFUNC_NAME: TStringField;
    crsFuncPDCT_NO: TStringField;
    crsFuncPDCT_NAME: TStringField;
    crsFuncEMP_TYPE: TStringField;
    crsFuncSTART_WT: TFloatField;
    crsFuncCLOSE_WT: TFloatField;
    crsFuncSTART_VOL: TFloatField;
    crsFuncCLOSE_VOL: TFloatField;
    crsFuncREMARK: TStringField;
    crsFuncGROUP_CODE: TStringField;
    crsFuncSYS_ACCOUNT: TStringField;
    crsFuncUPDATETIME: TStringField;
    crsFuncVERSION: TIntegerField;
    dsFunc: TDataSource;
    crsNode: TClientRowSet;
    crsdstNode: TClientRowSet;
    dsdstNode: TDataSource;
    procedure btSaveClick(Sender: TObject);
    procedure btCloseClick(Sender: TObject);
    procedure UniFormShow(Sender: TObject);
    procedure cbSendNodeCloseUp(Sender: TObject);
    procedure cbDstNodeCloseUp(Sender: TObject);
    procedure UniFormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure InitForm;
  end;

function FrmEditLine: TFrmEditLine;

implementation

{$R *.dfm}

uses
  MainModule, uniGUIApplication,basemodule,dictmodule,expmodule,uCommFunction;

function FrmEditLine: TFrmEditLine;
begin
  Result := TFrmEditLine(UniMainModule.GetFormInstance(TFrmEditLine));
end;

procedure TFrmEditLine.btCloseClick(Sender: TObject);
begin
  TClientRowset(dsLine.DataSet).CancelUpdates;
  self.Close;
end;

procedure TFrmEditLine.btSaveClick(Sender: TObject);
begin
  TClientRowset(dsLine.DataSet).ApplyUpdates;
  self.Close;
end;

procedure TFrmEditLine.cbDstNodeCloseUp(Sender: TObject);
begin
  dsLine.DataSet.Edit;
  dsLine.DataSet.FieldByName('DST_NODE_NAME').AsString := cbDstNode.Text;
end;

procedure TFrmEditLine.cbSendNodeCloseUp(Sender: TObject);
begin
  dsLine.DataSet.Edit;
  dsLine.DataSet.FieldByName('SRC_NODE_NAME').AsString := cbSendNode.Text;
end;

procedure TFrmEditLine.InitForm;
begin


end;





procedure TFrmEditLine.UniFormCreate(Sender: TObject);
begin
  SetCompoentLanguage(Self);
  crsNode.Data := dmDict.crsNode.Data;
  crsdstNode.Data := dmDict.crsNode.Data;
end;

procedure TFrmEditLine.UniFormShow(Sender: TObject);
begin
  InitForm;
end;

end.
